<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../css/oksub.css">
    <!--	<script type="text/javascript" src="lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>-->
<!--    <script type="text/javascript" src="lib/loading/okLoading.js"></script>-->
    <script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <meta http-equiv="refresh" content="60">
</head>
<body>
<div>
<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">编号</label>
        <div class="layui-input-inline">
            <input type="text" name="id"  readonly required lay-verify="required"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">原价金额</label>
        <div class="layui-input-inline">
            <input type="text" name="originalcost" required lay-verify="required" placeholder="请输入原价金额" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">实付金额</label>
        <div class="layui-input-inline">
            <input type="text" name="currentprice" required lay-verify="required" placeholder="请输入实际金额"  class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
<!--            <button  class="layui-btn layui-btn-primary">取消</button>-->
        </div>
    </div>
</form>

    <!--js逻辑-->
    <script src="../../lib/layui/layui.js"></script>
    <script>

        layui.use(["form", "laydate", "okLayer", "okUtils"], function () {
            let form = layui.form;
            let okLayer = layui.okLayer;
            let okUtils = layui.okUtils;
                    form.render('select');
                    form.on('submit(formDemo)', function(data){
                        layer.msg(JSON.stringify(data.field));
                        console.log(data.field)
                        okUtils.ajax("/credit/update", "post", data.field, true).done(function (response) {
                            okLayer.greenTickMsg(response.msg, function () {
                                parent.layer.close(parent.layer.getFrameIndex(window.name));
                                table.reload('tableId',{
                                    // where: data.field,
                                    // page: {curr: curr},
                                    page: {
                                        curr: 1
                                    }
                                    // , where: {
                                    // 	operator: result.operator
                                    // }
                                }, 'data');
                            });
                        }).fail(function (error) {
                            console.log(error)
                        });
                        return false;
                    });
        })
    </script>
</div>
</body>
</html>

</body>
</html>
